﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="QL_TinTuc.ascx.cs" Inherits="Admin_UserControl_QL_TinTuc" %>
<%@ Register Assembly="DevExpress.Web.v9.1" Namespace="DevExpress.Web.ASPxRoundPanel"
    TagPrefix="dxrp" %>
<%@ Register assembly="DevExpress.Web.v9.1" namespace="DevExpress.Web.ASPxPanel" tagprefix="dxp" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<div>
    <dxrp:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="100%" 
        CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass">
        <HeaderStyle BackColor="White" Height="23px">
        <Paddings PaddingBottom="0px" PaddingLeft="2px" PaddingTop="0px" />
        <BorderBottom BorderStyle="None" />
        </HeaderStyle>
        <TopLeftCorner Height="5px" Url="~/App_Themes/Glass/Web/rpTopLeftCorner.png" 
            Width="5px" />
        <NoHeaderTopLeftCorner Height="5px" 
            Url="~/App_Themes/Glass/Web/rpNoHeaderTopLeftCorner.png" Width="5px" />
        <TopRightCorner Height="5px" Url="~/App_Themes/Glass/Web/rpTopRightCorner.png" 
            Width="5px" />
        <NoHeaderTopRightCorner Height="5px" 
            Url="~/App_Themes/Glass/Web/rpNoHeaderTopRightCorner.png" Width="5px" />
        <BottomRightCorner Height="5px" 
            Url="~/App_Themes/Glass/Web/rpBottomRightCorner.png" Width="5px" />
        <BottomLeftCorner Height="5px" 
            Url="~/App_Themes/Glass/Web/rpBottomLeftCorner.png" Width="5px" />
        <HeaderLeftEdge>
            <BackgroundImage ImageUrl="~/App_Themes/Glass/Web/rpHeaderLeftEdge.gif" 
                Repeat="RepeatX" VerticalPosition="bottom" />
        </HeaderLeftEdge>
        <HeaderContent>
            <BackgroundImage ImageUrl="~/App_Themes/Glass/Web/rpHeaderBack.gif" 
                Repeat="RepeatX" VerticalPosition="bottom" />
        </HeaderContent>
        <HeaderRightEdge>
            <BackgroundImage ImageUrl="~/App_Themes/Glass/Web/rpHeaderRightEdge.gif" 
                VerticalPosition="bottom" />
        </HeaderRightEdge>
        <NoHeaderTopEdge BackColor="#EBF2F4">
        </NoHeaderTopEdge>
        <RightEdge>
            <BackgroundImage ImageUrl="~/App_Themes/Glass/Web/rpLeftRightEdge.gif" 
                Repeat="RepeatX" VerticalPosition="bottom" />
        </RightEdge>
        <BottomEdge BackColor="#D7E9F1">
        </BottomEdge>
        <LeftEdge>
            <BackgroundImage ImageUrl="~/App_Themes/Glass/Web/rpLeftRightEdge.gif" 
                Repeat="RepeatX" VerticalPosition="bottom" />
        </LeftEdge>
        <Content BackColor="White">
            <BackgroundImage Repeat="RepeatX" VerticalPosition="bottom" />
        </Content>
        <HeaderTemplate>
            <asp:Label ID="Label1" runat="server" Text="QUẢN LÝ TIN TỨC"></asp:Label>
        </HeaderTemplate>
        <PanelCollection>
<dxp:PanelContent runat="server" SupportsDisabledAttribute="True">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <asp:Label ID="Label2" runat="server" Text="Tiêu đề:"></asp:Label>
                        <telerik:RadTextBox ID="txtTitle" runat="server" MaxLength="250" 
                            Width="200px" AutoPostBack="True" ontextchanged="txtProductName_TextChanged">
                        </telerik:RadTextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txtProductName" ErrorMessage="*" ValidationGroup="save"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        <asp:Label ID="Label3" runat="server" Text="Tên sẩn phẩm không dấu:"></asp:Label>
                        <telerik:RadTextBox ID="txtProductNameNoSign" runat="server" MaxLength="250" Enabled="false" Width="200px">
                        </telerik:RadTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label4" runat="server" Text="Loại sản phẩm:"></asp:Label>
                        <telerik:RadComboBox ID="ddlCategory" Runat="server" 
                            EmptyMessage="-- chọn loại sản phẩm --">
                        </telerik:RadComboBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="ddlCategory" ErrorMessage="*" ValidationGroup="save"></asp:RequiredFieldValidator>
                    </td>
                    <td>
                        <asp:Label ID="Label5" runat="server" Text="Nhà cung cấp:"></asp:Label>
                        <telerik:RadComboBox ID="ddlSupplier" runat="server" 
                            DataSourceID="ods_Supplier" DataTextField="SupplierName" 
                            DataValueField="SupplierID" AllowCustomText="True" 
                            EmptyMessage="-- chọn nhà cung cấp --">
                        </telerik:RadComboBox> 
                        <asp:ObjectDataSource ID="ods_Supplier" runat="server" 
                            OldValuesParameterFormatString="original_{0}" SelectMethod="GetSuppliers" 
                            TypeName="DaiCuongMobileTableAdapters.tbSuppliersTableAdapter">
                        </asp:ObjectDataSource>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                            ControlToValidate="ddlSupplier" ErrorMessage="*" ValidationGroup="save"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label6" runat="server" Text="Giá nhập:"></asp:Label>
                        <telerik:RadNumericTextBox ID="txtPrice" runat="server">
                        </telerik:RadNumericTextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label7" runat="server" Text="Giá bán:"></asp:Label>
                        <telerik:RadNumericTextBox ID="txtSalePrice" runat="server">
                        </telerik:RadNumericTextBox>
                        <asp:CheckBox ID="ChBVisablePrice" runat="server" Checked="true" 
                            Text="Hiện/Ẩn Giá bán" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label8" runat="server" Text="Số lượng:"></asp:Label>
                        <telerik:RadNumericTextBox ID="txtQuantity" runat="server">
                        </telerik:RadNumericTextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label9" runat="server" Text="Ảnh lớn:"></asp:Label>
                        <telerik:RadUpload ID="RadUpload_BigImageURL" runat="server" 
                            AllowedFileExtensions="jpeg,jpg,png,gif,bmp" MaxFileInputsCount="1" 
                            MaxFileSize="524288" TargetFolder="~/Photos">
                            <Localization Clear="Hủy bỏ" Select="chọn ảnh" />
                        </telerik:RadUpload>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label10" runat="server" Text="Ảnh nhỏ:"></asp:Label>
                        <telerik:RadUpload ID="RadUpload_SmallImageURL" runat="server" 
                            AllowedFileExtensions="jpeg,jpg,png,gif,bmp" MaxFileInputsCount="1" 
                            MaxFileSize="524288" TargetFolder="~/Photos">
                            <Localization Clear="Hủy chọn" Select="Chọn ảnh" />
                        </telerik:RadUpload>
                    </td>
                    <td>
                    
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <telerik:RadEditor ID="txtDescriptions" runat="server" AllowScripts="True">
                            <ImageManager DeletePaths="~/Editor/IMG" UploadPaths="~/Editor/IMG" ViewPaths="~/Editor/IMG" MaxUploadFileSize="2800000" />
                        </telerik:RadEditor>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <telerik:RadButton ID="btnSaveProduct" runat="server" Text="Lưu lại" 
                            onclick="btnSaveProduct_Click" ValidationGroup="save">
                        </telerik:RadButton>
                        <asp:Label ID="lblWarning" runat="server" Text="" Visible="false"></asp:Label>
                    </td>
                </tr>
            </table>
            <asp:ObjectDataSource ID="ods_Products" runat="server" DeleteMethod="Delete" 
                OldValuesParameterFormatString="original_{0}" SelectMethod="GetProducts" 
                TypeName="DaiCuongMobileTableAdapters.tbProductsTableAdapter" 
                UpdateMethod="Update">
                <DeleteParameters>
                    <asp:Parameter Name="Original_ProductID" Type="Int64" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="ProductName" Type="String" />
                    <asp:Parameter Name="PrductNameNoSign" Type="String" />
                    <asp:Parameter Name="CategoryID" Type="Int32" />
                    <asp:Parameter Name="SupplierID" Type="Int32" />
                    <asp:Parameter Name="Price" Type="Decimal" />
                    <asp:Parameter Name="SalePrice" Type="Decimal" />
                    <asp:Parameter Name="Quantity" Type="Int32" />
                    <asp:Parameter Name="BigImageURL" Type="String" />
                    <asp:Parameter Name="SmallImageURL" Type="String" />
                    <asp:Parameter Name="PostDate" Type="DateTime" />
                    <asp:Parameter Name="PublishDate" Type="DateTime" />
                    <asp:Parameter Name="Descriptions" Type="String" />
                    <asp:Parameter Name="VisablePrice" Type="Boolean" />
                    <asp:Parameter Name="Original_ProductID" Type="Int64" />
                </UpdateParameters>
            </asp:ObjectDataSource>
            <telerik:RadGrid ID="gvProducts" runat="server" AllowAutomaticDeletes="True" 
                AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" 
                AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" CellSpacing="0" 
                DataSourceID="ods_Products" GridLines="None">
                <MasterTableView DataKeyNames="ProductID" DataSourceID="ods_Products">
                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" 
                        Visible="True">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" 
                        Visible="True">
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ProductID" DataType="System.Int64" 
                            FilterControlAltText="Filter ProductID column" HeaderText="ProductID" 
                            ReadOnly="True" SortExpression="ProductID" UniqueName="ProductID">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn DataField="ProductName" 
                            FilterControlAltText="Filter ProductName column" HeaderText="ProductName" 
                            SortExpression="ProductName" UniqueName="ProductName">
                            <EditItemTemplate>
                                <asp:TextBox ID="ProductNameTextBox" runat="server" 
                                    Text='<%# Bind("ProductName") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="ProductNameLabel" runat="server" 
                                    Text='<%# Eval("ProductName") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="PrductNameNoSign" 
                            FilterControlAltText="Filter PrductNameNoSign column" 
                            HeaderText="PrductNameNoSign" SortExpression="PrductNameNoSign" 
                            UniqueName="PrductNameNoSign">
                            <EditItemTemplate>
                                <asp:TextBox ID="PrductNameNoSignTextBox" runat="server" 
                                    Text='<%# Bind("PrductNameNoSign") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="PrductNameNoSignLabel" runat="server" 
                                    Text='<%# Eval("PrductNameNoSign") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="CategoryID" DataType="System.Int32" 
                            FilterControlAltText="Filter CategoryID column" HeaderText="CategoryID" 
                            SortExpression="CategoryID" UniqueName="CategoryID">
                            <EditItemTemplate>
                                <asp:TextBox ID="SupplierIDTextBox" runat="server" 
                                    Text='<%# Bind("SupplierID") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="SupplierIDLabel" runat="server" Text='<%# Eval("SupplierID") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="SupplierID" DataType="System.Int32" 
                            FilterControlAltText="Filter SupplierID column" HeaderText="SupplierID" 
                            SortExpression="SupplierID" UniqueName="SupplierID">
                            <EditItemTemplate>
                                <asp:TextBox ID="CategoryIDTextBox" runat="server" 
                                    Text='<%# Bind("CategoryID") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="CategoryIDLabel" runat="server" Text='<%# Eval("CategoryID") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Price" DataType="System.Decimal" 
                            FilterControlAltText="Filter Price column" HeaderText="Price" 
                            SortExpression="Price" UniqueName="Price">
                            <EditItemTemplate>
                                <telerik:RadNumericTextBox ID="RadNumericTextBox1" Runat="server" 
                                    Culture="en-US" DbValue='<%# Bind("Price") %>' LabelWidth="" Width="125px">
                                </telerik:RadNumericTextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="SalePriceLabel" runat="server" Text='<%# Eval("SalePrice") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="SalePrice" DataType="System.Decimal" 
                            FilterControlAltText="Filter SalePrice column" HeaderText="SalePrice" 
                            SortExpression="SalePrice" UniqueName="SalePrice">
                            <EditItemTemplate>
                                <telerik:RadNumericTextBox ID="RadNumericTextBox2" Runat="server" 
                                    Culture="en-US" DbValue='<%# Bind("SalePrice") %>' LabelWidth="" Width="125px">
                                </telerik:RadNumericTextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("Price") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Quantity" DataType="System.Int32" 
                            FilterControlAltText="Filter Quantity column" HeaderText="Quantity" 
                            SortExpression="Quantity" UniqueName="Quantity">
                            <EditItemTemplate>
                                <telerik:RadNumericTextBox ID="RadNumericTextBox3" Runat="server" 
                                    Culture="en-US" DbValue='<%# Bind("Quantity") %>' LabelWidth="" Width="125px">
                                </telerik:RadNumericTextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="QuantityLabel" runat="server" Text='<%# Eval("Quantity") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="BigImageURL" Display="False" 
                            FilterControlAltText="Filter BigImageURL column" HeaderText="BigImageURL" 
                            SortExpression="BigImageURL" UniqueName="BigImageURL" Visible="False">
                            <EditItemTemplate>
                                <asp:TextBox ID="SmallImageURLTextBox" runat="server" 
                                    Text='<%# Bind("SmallImageURL") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="SmallImageURLLabel" runat="server" 
                                    Text='<%# Eval("SmallImageURL") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="SmallImageURL" Display="False" 
                            FilterControlAltText="Filter SmallImageURL column" HeaderText="SmallImageURL" 
                            SortExpression="SmallImageURL" UniqueName="SmallImageURL" Visible="False">
                            <EditItemTemplate>
                                <asp:TextBox ID="BigImageURLTextBox" runat="server" 
                                    Text='<%# Bind("BigImageURL") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="BigImageURLLabel" runat="server" 
                                    Text='<%# Eval("BigImageURL") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="PostDate" DataType="System.DateTime" 
                            FilterControlAltText="Filter PostDate column" HeaderText="PostDate" 
                            SortExpression="PostDate" UniqueName="PostDate">
                            <EditItemTemplate>
                                <asp:TextBox ID="PostDateTextBox" runat="server" Text='<%# Bind("PostDate") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="PostDateLabel" runat="server" Text='<%# Eval("PostDate") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="PublishDate" DataType="System.DateTime" 
                            Display="False" FilterControlAltText="Filter PublishDate column" 
                            HeaderText="PublishDate" SortExpression="PublishDate" UniqueName="PublishDate" 
                            Visible="False">
                            <EditItemTemplate>
                                <asp:TextBox ID="PublishDateTextBox" runat="server" 
                                    Text='<%# Bind("PublishDate") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="PublishDateLabel" runat="server" 
                                    Text='<%# Eval("PublishDate") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Descriptions" Display="False" 
                            FilterControlAltText="Filter Descriptions column" HeaderText="Descriptions" 
                            SortExpression="Descriptions" UniqueName="Descriptions" Visible="False">
                            <EditItemTemplate>
                                <asp:TextBox ID="DescriptionsTextBox" runat="server" 
                                    Text='<%# Bind("Descriptions") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="DescriptionsLabel" runat="server" 
                                    Text='<%# Eval("Descriptions") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridCheckBoxColumn DataField="VisablePrice" DataType="System.Boolean" 
                            FilterControlAltText="Filter VisablePrice column" HeaderText="VisablePrice" 
                            SortExpression="VisablePrice" UniqueName="VisablePrice" Display="False" 
                            Visible="False">
                        </telerik:GridCheckBoxColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <FilterMenu EnableImageSprites="False">
                    <WebServiceSettings>
                        <ODataSettings InitialContainerName="">
                        </ODataSettings>
                    </WebServiceSettings>
                </FilterMenu>
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                    <WebServiceSettings>
                        <ODataSettings InitialContainerName="">
                        </ODataSettings>
                    </WebServiceSettings>
                </HeaderContextMenu>
            </telerik:RadGrid>
            <br />

        </ContentTemplate>
        <Triggers>            
            <asp:PostBackTrigger ControlID="btnSaveProduct" />            
        </Triggers>
    </asp:UpdatePanel>
</dxp:PanelContent>
</PanelCollection>
        <Border BorderColor="#7EACB1" BorderStyle="Solid" BorderWidth="1px" />
    </dxrp:ASPxRoundPanel>  
</div>